#pragma once

class Drive {
private:
	string driveName;
	string drivePath;
	string physicalPath;
	BOOL mounted;

public:

	BOOL IsMounted() {

		WIN32_FIND_DATA findFileData;
        memset(&findFileData,0,sizeof(WIN32_FIND_DATA));
        string searchcmd = drivePath + "\\*.*";
		HANDLE hFind = FindFirstFile(searchcmd.c_str(), &findFileData);
        if (hFind == INVALID_HANDLE_VALUE)
        {
			if(Mount() == S_OK)
				return 1;

            return 0;
        }
        FindClose(hFind);

        return 1;
	}
	const CHAR* GetDriveName() { return driveName.c_str(); }
	const CHAR* GetDrivePath() { return drivePath.c_str(); }
	const CHAR* GetPhysicalPath() { return physicalPath.c_str(); }

	Drive(const CHAR* DrivePath, const CHAR* PhysicalPath);
	~Drive() {}

	HRESULT Mount();
	HRESULT MountForTitle();
	HRESULT Unmount();
};

class FileSystem {
private:
	vector<Drive*> drives;

public:

	vector<Drive*>& GetDrives() { return drives; }

	static FileSystem& getInstance() {
		static FileSystem singleton;
		return singleton;
	}

	FileSystem();
	~FileSystem() {}

	HRESULT MountDrives();
	HRESULT UnMountDrives();
	HRESULT VerifyDrives();
	HRESULT MountForTitle(const char* Path);
};